package com.example.user.service;


import com.example.user.common.Result;
import com.example.user.entity.Comment;
import com.example.user.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentService {


    @Autowired
    private CommentMapper commentMapper;

    public  Result addComment(Comment comment) {
       int  count= commentMapper.addComment(comment);
       if(count==0)
       {
           return Result.error("400","添加失败");
       }

       return Result.success("评论成功");
    }

    public List<Comment> selectCommentPage(Integer activityId) {

       List<Comment> commentList= commentMapper.selectCommentPage(activityId);
       return commentList;
    }
}
